<template>
  <div ref="myChart" class="line-chart" />
</template>

<script >
import * as echarts from 'echarts'
export default {
  name: 'CircleChart',
  props: ['circleData'],
  data() {
    return {
    }
  },
  mounted() {
    this.chartRun()
  },
  methods: {
    chartRun() {
      const myChart = echarts.init(this.$refs.myChart)
      window.addEventListener('resize', myChart.resize)

      const that = this

      const option = {
        color: ['#6dffd7', '#f9ed67', '#e06de4'],
        tooltip: {
          trigger: 'item'
        },
        legend: {
          top: '5%',
          left: 'center',
          textStyle: {
            fontSize: 16, // 字体大小
            color: '#ffffff'// 字体颜色
          }
        },
        series: [
          {
            name: '百分比',
            type: 'pie',
            radius: ['40%', '70%'],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 20,
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: that.circleData
          }
        ]

      }

      myChart.setOption(option)
    }
  }
}

</script>
<style scoped>
.line-chart{
 width: 100%;
 flex: 1;
 }
</style>
